package com.xiaoshuidi.cloud.module.rooms.api;

import cn.hutool.core.bean.BeanUtil;
import com.xiaoshuidi.cloud.framework.common.pojo.CommonResult;
import com.xiaoshuidi.cloud.module.rooms.api.map.BaiDuMapAppApi;
import com.xiaoshuidi.cloud.module.rooms.api.map.vo.GetHFAdministrativeVO;
import com.xiaoshuidi.cloud.module.rooms.controller.admin.map.vo.GetHFAdministrative;
import com.xiaoshuidi.cloud.module.rooms.service.RoomStreetLatlonService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;


@Slf4j
@RestController
@DubboService
@RequiredArgsConstructor
public class BaiDuMapAppApiImpl implements BaiDuMapAppApi {

    private final RoomStreetLatlonService roomStreetLatlonService;

    @Override
    public CommonResult<List<GetHFAdministrativeVO>> getHFAdministrative() {
        List<GetHFAdministrative> hfAdministrative = roomStreetLatlonService.getHFAdministrative();
        List<GetHFAdministrativeVO> respVOS = new ArrayList<>();
        for (GetHFAdministrative getHFAdministrative : hfAdministrative) {
            GetHFAdministrativeVO respVO = new GetHFAdministrativeVO();
            BeanUtil.copyProperties(getHFAdministrative, respVO);
            respVOS.add(respVO);
        }
        return CommonResult.success(respVOS);
    }
}
